import request from '@/utils/request'
import qs from 'qs'

// 获取医生列表
export function doctorList(data) {
  return request({
    url: '/service/doctorList',
    method: 'post',
    data
    /* paramsSerializer: function(params) {
      return qs.stringify(params, { arrayFormat: 'indices' })
    }*/
  })
}

// 删除医生
export function deleteDoctor(data) {
  return request({
    url: '/service/deleteDoctor',
    method: 'post',
    data
  })
}

// 累计订单、累计收入详情列表页
export function serviceCountList(data) {
  return request({
    url: '/service/serviceCountList',
    method: 'get',
    params: data
  })
}

// 新增服务时间模板
export function addServiceTime(data) {
  return request({
    url: '/service/addServiceTime',
    method: 'post',
    data
  })
}

// 新增医生
export function addDoctor(data) {
  return request({
    url: '/service/addDoctor',
    method: 'post',
    data
  })
}

// 根据服务城市id查询服务列表
export function getServiceByCityId(data) {
  return request({
    url: '/service/getServiceByCityId',
    method: 'get',
    params: data
  })
}

// 获取服务时间模板列表
export function getServiceTimeList(query) {
  return request({
    url: '/service/getServiceTimeList',
    method: 'get',
    params: query,
    paramsSerializer: function(params) {
      return qs.stringify(params, { arrayFormat: 'indices' })
    }
  })
}

// 查看某一天和后一天的排班列表
export function appointmentServiceCity(query) {
  return request({
    url: '/service/appointService/serviceCity',
    method: 'get',
    params: query,
    paramsSerializer: function(params) {
      return qs.stringify(params, { arrayFormat: 'indices' })
    }
  })
}

// 加载该服务的运营城市页面
export function loadOnlineServiceCity(type, id) {
  return request({
    url: '/service/loadOnlineServiceCity/' + type + '/' + id,
    method: 'post'
  })
}

// 科室列表
export function departmentList(query) {
  return request({
    url: '/service/departmentList',
    method: 'get',
    params: query,
    paramsSerializer: function(params) {
      return qs.stringify(params, { arrayFormat: 'indices' })
    }
  })
}

// 新增科室
export function addDepartment(data) {
  return request({
    url: '/service/addDepartment',
    method: 'post',
    data
  })
}

// 删除科室
export function deleteDepartment(data) {
  return request({
    url: '/service/deleteDepartment',
    method: 'post',
    data
  })
}

// 排班查询
export function shiftTableByCityId(query) {
  return request({
    url: '/service/shiftTable/serviceCity',
    method: 'get',
    params: query,
    paramsSerializer: function(params) {
      return qs.stringify(params, { arrayFormat: 'indices' })
    }
  })
}

// 取消城市运营
export function cancleOnlineServiceCity(data) {
  return request({
    url: '/service/cancleOnlineServiceCity',
    method: 'post',
    data
  })
}

// 增加、编辑该服务的运营城市
export function addOnlineServiceCity(data) {
  return request({
    url: '/service/addOnlineServiceCity',
    method: 'post',
    data
  })
}

// 更新在线服务上下架状态
export function changeState(data) {
  return request({
    url: '/service/changeState',
    method: 'post',
    data
  })
}

// 用于获取服务运营城市/不为运营城市的列表
export function onlineServiceCityList(data) {
  return request({
    url: '/service/onlineServiceCityList',
    method: 'post',
    data
    /* paramsSerializer: function(params) {
      return qs.stringify(params, { arrayFormat: 'indices' })
    }*/
  })
}

// 用于获取服务不为运营城市的列表
export function unlinkCityList(data) {
  return request({
    url: '/service/unlinkCityList',
    method: 'post',
    data
  })
}

// 新增/编辑在线服务
export function addOnlineService(data) {
  return request({
    url: '/service/addOnlineService',
    method: 'post',
    data
  })
}

// 在线服务列表
export function onlineServiceList(query) {
  return request({
    url: '/service/onlineServiceList',
    method: 'get',
    params: query,
    paramsSerializer: function(params) {
      return qs.stringify(params, { arrayFormat: 'indices' })
    }
  })
}

// 根据已经添加的服务,获取当前数据库中已有的服务分类
export function getClassByService(query) {
  return request({
    url: '/service/getClassByService',
    method: 'get',
    params: query
    /* paramsSerializer: function(params) {
      return qs.stringify(params, { arrayFormat: 'indices' })
    }*/
  })
}

// 根据已经添加的服务,获取当前数据库中已有的服务分类
export function getInfoById(data) {
  return request({
    url: '/service/getInfo',
    method: 'post',
    data
  })
}

// 根据已经添加的服务,获取当前数据库中已有的服务分类
export function deleteById(data) {
  return request({
    url: '/service/deleteService',
    method: 'post',
    data
  })
}

